In computer science, the phrase datatype, or type, is used to identify a set of values and operations that can be performed on that set of values. Many programming languages support one or more types, whether implicitly or explicitly. These types may act as a statically or dynamically checked constraint on the programs written in a given language. Types are usually associated with values in memory or with objects such as, for example, variables. Because a value is typically nothing more than a group of bits read by a processor, there is not usually any distinction in the hardware, even among memory addresses, instruction code, characters, integers and floating-point numbers. Therefore, types can be used to indicate how a given collection of bits should be treated.
Typically, values are associated with a given type, although a given type may have associated with it one or more subtypes. Other entities, including dependencies, objects, modules, etc. can be associated with a type. Additionally, a given type can be associated with another type. A type system can be implemented for a programming language to define rules by which the typed program's behavior is governed. Type checking can be used to verify conformance with the rules and to enforce constraints dictated by the type. Type checking can be performed during compilation or at runtime.
Thus, programming languages can be dynamically typed or statically typed. With dynamic typing, typing of variables can be performed on the basis of a given execution path. That is, the typing of a variable may be different. Therefore, dynamic typing is typically performed at runtime. Dynamic typing is often associated with languages such as scripting languages as well as with rapid application development environments. Static types, on the other hand, are often used with compiled languages.
Many scripting languages, for example JAVASCRIPT, do not require the developer to specify the type of their variables, fields, and parameters or the return types of their functions. Also, variable types can change throughout the lifetime of a script's execution. As a result, it is very difficult for a tool, such as an IDE (Integrated Development Environment), to assist the developer with contextual information while they are editing source files. These languages are not necessarily “typeless” in that they have no types, but more accurately the types are not static in that their application is not constrained as in a typed environment. Such languages tend to enable simplifying the task of connecting components, because they all look and behave the same and are therefore interchangeable. For example, a variable may be able to hold a string one moment and an integer the next. Because code and data may be interchangeable, a program can write another program and then execute it on the fly. With such dynamically-typed languages, variable types are typically identified at execution.
Additionally, a dynamically-typed language can facilitate component connections. This is because there are no type-based rules governing use of components and values, and all components and values can be uniformly represented. Thus a component or value can be used in multiple situations. For example, a component designed for one purpose by one designer can be used for a completely different purpose that may never have been envisioned by the original designer. Therefore, dynamically-typed programming languages may encourage reuse of components and values and minimize the uses of multiple, potentially incompatible interfaces. Because in a typed system, a given interface requires objects of specific types the compiler will prevent other types of objects from being used with the interface. With a dynamically-typed system, a new object can utilize an existing interface without the need for conversion code to be written to translate between the types. This can save recompiling part or all of the application.
Further features and advantages of the present invention, as well as the structure and operation of various embodiments of the present invention, are described in detail below.